package com.ilancuo.numric;

/**
 * 位移操作测试
 * @author ilancuo
 * 2020-01-07
 */
public class TestShift {
    public static void main(String[] args) {
        int num = -7;
        System.out.println(Integer.toBinaryString(num));
        int left3 = num << 3;
        System.out.println(left3 + ", " + Integer.toBinaryString(left3));
        int right2 = num >> 2;
        System.out.println(right2 + ", " + Integer.toBinaryString(right2));
        int right3 = num >>> 2;
        System.out.println(right3 + ", " + Integer.toBinaryString(right3));
    }
}
